<% if @vm.display_state != "running" %>
  <div class="auto-refresh hidden" data-interval="10"></div>
<% end %>

<% data = [
      ["ID", @vm.ubid],
      ["Name", @vm.name],
      ["Location", @vm.display_location],
      ["Size", @vm.display_size],
      ["Storage", (@vm.storage_size_gib > 0) ? "#{@vm.storage_size_gib} GB" : nil]
    ]
  if (gpu = @vm.display_gpu)
    data << ["GPU", gpu]
  end
  subnet = @vm.nics.first.private_subnet
  data += [
      ["IPv4", @vm.ip4_enabled ? @vm.ip4 : "Not enabled", { copyable: @vm.ip4_enabled }],
      ["IPv6", @vm.ip6, { copyable: true }],
      [
        "SSH Command",
        "<span class='bg-slate-100 text-rose-500 font-mono px-2 py-1 rounded'>#{h("ssh -i <PRIVATE_KEY_PATH> #{@vm.unix_user}@#{@vm.ip4 || @vm.ip6}")}</span>",
        { escape: false }
      ],
      ["Private IPv4", @vm.private_ipv4, { copyable: true }],
      ["Private IPv6", @vm.private_ipv6, { copyable: true }],
      [
        "Private subnet",
        "<a href='#{path(subnet)}' class='text-rose-500 hover:underline'>#{subnet.name}</a>",
        { escape: false }
      ]
    ] %>

<%== part(
  "components/kv_data_card",
  data:
) %>
